package com.custom.common.config;

import com.custom.common.interceptor.RequestInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * 
 * @ClassName:  InterceptorConfig   
 * @Description:TODO 拦截器注册 
 * @author: lizhen
 * @date:   2018年8月2日 下午4:21:29   
 *
 */
@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {

	@Autowired
	private RequestInterceptor requestInterceptor;

	 @Override
	 public void addInterceptors(InterceptorRegistry registry) {
		  //拦截地址参数
	      String apiUri = "/system/**";
	      String rpcApiUri = "/*";
	      String[] uri = {apiUri, rpcApiUri};
	      //响应结果控制拦截
	//	 registry.addInterceptor(responseResultInterceptor) .addPathPatterns(uri);

		 registry.addInterceptor(requestInterceptor)
				 .addPathPatterns(uri)
				.excludePathPatterns(new String[]{""});

	 }

}
